Method for fast access to flash-memory media

ABSTRACT

In one embodiment, the invention comprises a flash-media controller used for writing new data from an external system to a local flash-memory device. The newly written data may replace old data previously written to the flash-memory device, and may be written directly to unused locations within the flash-memory device. The flash-media controller may comprise a table of block descriptors and sector descriptors used to track specified characteristics of each block and sector of the flash-memory device, thereby allowing for write sequences to non-contiguous sectors within a block. Accordingly, copy operations may be deferred under the expectation that they will eventually become unnecessary, thereby designating old data as having become stale. Once all data within a block has been designated as being stale, the block may be marked as unused and may be made available for subsequent write operations, thereby providing fast write access to the flash-memory device, and significantly reducing the number of required copy operations during data transfer to the flash-memory device.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates generally to the field of digital interfacedesign and, more particularly, to digital storage interface design.

2. Description of the Related Art

In recent years the electronics marketplace has seen a proliferation ofappliances and personal electronics devices that use solid-state memory.For example, traditional film cameras have been losing market share todigital cameras capable of recording images that may be directlydownloaded to and stored on personal computers (PCs). The picturesrecorded by digital cameras can easily be converted to common graphicsfile formats such as JPEG, GIF or BMP, and sent as e-mail attachments orposted on web pages and online photo albums. Many digital cameras arealso capable of capturing short video clips in standard digital videoformats, for example MPEG-2, which may also be directly downloaded andstored on PCs or notebook computers. Other devices that typically usesolid-state memory include personal digital assistants (PDAs), pocketPCs, video game consoles and MP3 players.

The most widely used solid-state memory devices comprise flash-memorychips configured on a small removable card, and are commonly referred toas flash-memory cards. The majority of flash-memory cards currently onthe market typically comprise one of four different types: CompactFlash, Multi Media Card (MMC) and the related Secure Digital Card (SD),SmartMedia, and Memory Stick. Most digital cameras, for example, useCompact Flash cards to record images. Many PDA models use Memory Stickcards to hold data. Some MP3 players store music files on Smart Mediacards. Generally, data saved by PDAs and other handheld devices usingflash-memory cards are also transferred or downloaded to a PC. In thepresent application, the term “flash-memory” is intended to have thefull breadth of its ordinary meaning, which generally encompassesvarious types of non-volatile solid-state memory devices.

Generally, data in flash-memory devices may be erased in units of blocksand written in units of pages. Blocks typically designate a minimumErasable Unit (EU), and consist of a plurality of pages, which serve asa minimum Read/Write Unit (RWU). A block must typically be erased in itsentirety before data can be updated (re-written). In other words,flash-memory is typically used as a file store. File systems usuallymaintain data on the device in units of 512 bytes, commonly calledsectors. The table in FIG. 1 illustrates the page/block/sectororganization of several common flash-memory devices.

An external system typically transfers data to a flash-memory device insets of contiguous sectors using a logical sector address and a sectorcount. A flash-media controller may be used to translate the logicalsector address provided by the external system into a physical sectoraddress on the flash-memory device. By convention, contiguous logicalsectors that fall within the address range of a logical block are storedcontiguously within the same physical block. The convention to keepsectors contiguous has several motivating factors. One is to avoid thecost of memory intensive look-up tables used to associate each logicalsector with a physical sector. For example, a 128 MB flash-memory devicewill typically have 262,144 sectors. A per-sector lookup table wouldrequire at least one megabyte of storage. Another motivating factor isdue to external systems typically transferring data in contiguoussectors using a first sector address and a sector count. Keeping thephysical sectors contiguous generally erases a time penalty associatedwith a table lookup for each sector involved in the transfer.

Blocks may sometimes contain physically damaged electrical components.Damaged blocks are typically marked as invalid and are not used to storedata. External systems are generally not designed to manage invalidblocks. Therefore, the flash-media controller must maintain a table ofreplacement blocks. This table may be used to translate logicaladdresses provided by external systems into physical addresses of validblocks on the flash memory. Since some physical blocks may be invalid,it is not always possible to store logical blocks contiguously on theflash memory device.

External systems also frequently update (re-write) existing data. Theseupdates take place within a few sectors of a block. A flash-mediacontroller must typically establish a set of unused (or erased) pages toreceive incoming data. Previously written data that falls outside therange of the current write operation must be preserved. Rewriting dataon a flash memory device often entails re-arrangement of existing datausing copy operations. As previously noted, this re-arrangement isnecessary in order to maintain contiguous data and thereby minimizeresources required to locate previously written data. The copyoperations are generally time costly and interrupt the continuous flowof data from the external system to the flash memory, thereby reducingthe overall write speed of the device.

There are currently a variety of methods used for re-arranging existingdata on flash-memory devices. Sometimes, random access memory (RAM) orstatic random access memory (SRAM) resources are used for caching dataprior to writing to the flash-memory device. At other times the data maybe written to available read/write units and maintaining contiguous datamay not even be attempted. One method involves assuming linear(contiguous) writes, and maintaining contiguous data by keeping anext-sector pointer. Relevant examples of current methods are presentedin SMIL (SmartMedia™ Interface Library) Software Edition Version 1.00,Toshiba Corporation, published on Jul. 1, 2000, and in SMIL™ Standard2000 Supplement Vol. 1, issued on Nov. 20, 2000 as part of the SSFDCForum Technical Reference.

Caching solutions typically require significant temporary storageexternal to the flash-memory device, such as RAM or SRAM. Smallinexpensive devices do not have storage sufficient for large re-writeoperations. Adding external storage resources typically addssignificantly to the cost and complexity of the device. Resolving thisissue may necessitate a mechanism to eliminate copy operations withoutrequiring temporary storage external to the flash memory. Writing thedata to available non-contiguous read/write units generally requires alarger and more complex lookup table. Larger flash memory devices maycontain many thousands of read/write units, making the size of thelookup table prohibitive for a small inexpensive flash media controller.

Other corresponding issues related to the prior art will become apparentto one skilled in the art after comparing such prior art with thepresent invention as described herein.

SUMMARY OF THE INVENTION

Various embodiments of a system and method to significantly reduce thenumber of data copy operations performed during the transfer of data toa flash-memory device are presented. In one embodiment, a memorycontroller is used to manage non-volatile memory devices, for exampleflash-memory devices (flash electrically erasable programmable read onlymemory, otherwise referred to as flash EEPROM), where transferring datato the flash-memory devices is performed such that unnecessary and timecostly operations, as well as memory intensive data structures relatedto the management of the flash memory devices are minimized. The datamay be maintained contiguously, thereby minimizing the storagerequirements of corresponding lookup tables. Copy operations may bereduced or eliminated by deferring them as long as possible. The sizeand extent of structures used to describe the deferred copy operationsmay be limited, in turn minimizing RAM requirements.

The non-volatile memory device may be organized into a plurality ofminimum erasable-units called blocks, and each block may be organizedinto a plurality of subunits called sectors. In one set of embodiments,re-write operations to a flash-memory device may be allowed to partiallycomplete by skipping the final copy phase, and a descriptor of thecurrent state of the re-write operation may be maintained in a RAMcache. The descriptor may identify which sectors of a block have beeninvolved in the re-write operation. The descriptor may also be updatedas subsequent re-write operations are initiated referencing the sameblock. The cache may contain descriptors for a plurality of partiallyre-written blocks. A block's descriptor may be removed from the RAMcache once all the block's sectors have been re-written. Upon reachingcache resource limits, the descriptors may be removed from the cacheafter forcing completion of deferred copy operations.

In one embodiment, the flash media controller includes a table of blockdescriptors—each block being identified as a minimum erasable-unit—thatmay be configured to hold physical block address information, logicalblock address information, as well as status information pertaining tothe physical and logical blocks. In one embodiment, physical blocks thatare partially re-written (when the data is divided across two or morephysical blocks) receive a corresponding sector descriptor. Each sectordescriptor may contain information about the physical sectors containedin a physical block, as well as information regarding data contained inthe physical sectors. When an external system requests a re-writeoperation, the flash-media controller may locate a candidate block,whose attributes meet a previously determined set of criteria, anddesignate a candidate physical block based on another set of previouslydetermined criteria. The re-write operation may then be processed usingthe candidate physical block.

The flash-media controller may reclaim resources at will. Reclamationmay be necessary due to resource constraints such as limited storage forsector descriptors or a limited number of unbound blocks. Reclamationmay be desired to improve performance of read operations or to simplifyfault recovery. Resources associated with a partially re-written blockmay be reclaimed by first selecting a candidate physical block forreclamation, then selecting a subsequent partially re-written physicalblock associated with the same logical block. Dormant sectors from thecandidate block may be copied to the subsequent block, where a dormantsector may be defined as meeting a previously established set ofcriteria. The flash-media controller may then update the dirty-sectormap associated with the subsequent block to reflect the sectors copiedin the prior step, and reclaim the sector descriptor associated with thecandidate physical block. Subsequently, the flash-media controller maymark the candidate physical block as unbound in the associated blockdescriptor.

Thus various embodiments of the invention offer a system and method forproviding fast write access to flash-memory media while significantlyreducing the number of data copy operations performed during thetransfer of data to the flash-memory media. New data may be writtendirectly to the flash-memory media without first being cached, and asequence of re-write operations may target non-contiguous sectors of anygiven block or blocks.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing, as well as other objects, features, and advantages ofthis invention may be more completely understood by reference to thefollowing detailed description when read together with the accompanyingdrawings in which:

FIG. 1 illustrates the organization of several common flash-memorydevices, according to prior art;

FIG. 2 shows the block diagram of a flash-memory controller according toone set of embodiments of the present invention;

FIG. 3 illustrates a table of block descriptors according to oneembodiment of the present invention;

FIG. 4 illustrates a sector descriptor for a partially written physicalblock, according to one embodiment of the present invention;

FIGS. 5(A-E) illustrate a sequence of events that occur during a seriesof consecutive re-write operations, according to one embodiment of thepresent invention;

FIGS. 6(A-C) illustrate how split-blocks are condensed following asuccessful re-write operation, according to one embodiment of thepresent invention;

FIG. 7 illustrates how a small file is written, according to oneembodiment;

FIGS. 8(A-B) illustrate how a split-block is updated when writing asmall file, according to one embodiment of the present invention; and

FIG. 9 illustrates how resources are reclaimed in one embodiment of thepresent invention.

While the invention is susceptible to various modifications andalternative forms, specific embodiments thereof are shown by way ofexample in the drawings and will herein be described in detail. Itshould be understood, however, that the drawings and detaileddescription thereto are not intended to limit the invention to theparticular form disclosed, but on the contrary, the intention is tocover all modifications, equivalents, and alternatives falling withinthe spirit and scope of the present invention as defined by the appendedclaims. Note, the headings are for organizational purposes only and arenot meant to be used to limit or interpret the description or claims.Furthermore, note that the word “may” is used throughout thisapplication in a permissive sense (i.e., having the potential to, beingable to), not a mandatory sense (i.e., must).” The term “include”, andderivations thereof, mean “including, but not limited to”. The term“coupled” means “directly or indirectly connected”.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

As referenced herein, the terms “flash-memory” and “flash-media” areused interchangeably to mean a special type of electrically erasableprogrammable read-only memory (EEPROM) that can be erased andreprogrammed in minimum erasable-units, referred to herein as ‘blocks’,instead of one byte at a time. In addition, each block may be organizedinto subunits called ‘sectors’, where a sector may represent a minimumdata size for data stored on a given flash-memory device. Whilepreferred embodiments are described in detail for flash-memory devicesorganized into blocks and sectors, alternate embodiments featuring othertypes of non-volatile memory devices organized into minimumerasable-units and subunits are possible and are contemplated.Therefore, it should be understood that “block”, specifically, is usedinterchangeably with what is referred to generally as “erasable unit” or“EU” for short. As also used herein, “writing a sector” or “writing asubunit” means writing data to the sector or subunit, and a given sectoror subunit is “used” when data has been written to it. Similarly,“erasing a sector” or “erasing a subunit” means erasing data that hadpreviously been written to the sector or subunit, and a given sector orsubunit is “unused” when no data has been written to it. Furthermore,subunits or sectors are said to be ‘contiguous’ if they have successivephysical sector numbers (or addresses). Such subunits or sectors may ormay not be physically located next to each other on a given device.Similarly, subunits or sectors are said to be ‘non-contiguous’ if theydo not have successive physical sector numbers (or addresses). The sameterminology is applicable for erasable-units or blocks and for theentire non-volatile memory device. ‘Intervening copy operations’ referto the copying of pre-existing data on a given non-volatile memorydevice from one physical location to another physical location withinthe non-volatile memory device, or from the non-volatile memory deviceto an external memory, then back to the non-volatile memory device.

FIG. 2 illustrates one embodiment of a flash media controller (FMC) 200used to transfer data from an external system to a flash-memory device.In this embodiment, bus 214 is used for transmitting address informationand target data to FMC 200 from a host system, where target data refersto data that is to be written to flash-memory devices 210. FMC 200 mayinclude a read-only memory (ROM) 204 configured to store controlinstructions for managing data transfer through flash media interface(FMI) 202 to/from flash-memory devices 210. The control instructions maybe executed by central processing unit (CPU core) 206, which may becoupled to ROM 204, FMI 202 and to an address and management block (ADM)201 via bus 212. ADM 201 may be configured to partially managetransmission of the target data from ADM 210 to FMI 202 via bus 216.Control information may also be transmitted to FMI 202 via bus 212. Datatransfer to flash-memory devices 210 may take place according to thecontrol instructions, which may be configured and/or written toreference and/or manage information for various data organizationstructures and indicators, thereby determining the operation of FMI 202.

As previously mentioned, data organization structures may include blocksand sectors, where a block may be representative of a minimumerasable-unit within any given one of flash-memory devices 210, andwhere a sector may be representative of a minimum data size for datastored within a given block. In one set of embodiments, the operation ofFMI 202 may include tracking re-write operations on a per-sector basis,and writing new data directly to the flash-memory device. This may beaccomplished through both block descriptors and sector descriptors usedto track specified characteristics of all blocks within a givenflash-memory device, and all sectors within a block.

Accordingly, FMC 200 may include a memory element SRAM 208, which may beused to store a table of block descriptors. The block descriptors maycontain information pertaining to physical and logical blocks associatedwith the given flash-memory device. FIG. 3 shows the organization of oneembodiment of a table 300 of block descriptors and a correspondingflash-media device 306 that contains physical blocks 305. In oneembodiment, table 300 contains one entry for each logical block, asshown in column 301. Each logical block entry in column 301 may have acorresponding physical block number (or address), shown in column 302.The physical block number (from column 302) may be used by FMC 200 toconvert a given logical block address into a physical block address fora given corresponding flash-memory device. The physical block number mayalso be used to convert a given physical block address into a logicalblock address for the given corresponding flash-memory device. Forexample, in FIG. 3, logical block 2 (from column 301) corresponds tophysical block 4 (from column 305), as indicated by physical blocknumber ‘4’ in column 302.

Table 300 may also include a flag, shown in column 303, which mayindicate whether a given logical block (from column 305) is bound to aphysical block. For example, a ‘1’ in column 303 for logical blocknumber ‘2’ (from column 301) may indicate that logical block number ‘2’is bound to physical block number ‘4’ (from 305). A flag, shown incolumn 304, may indicate whether a given logical block is partiallyre-written. For example, a ‘1’ in column 304 corresponding to logicalblock number ‘2’ may indicate that logical block number ‘2’ has beenpartially re-written.

Other embodiments may feature a table of descriptors that containsadditional feature descriptors while omitting some of the descriptorspreviously described. One possible additional descriptor may be a flagindicating whether a given physical block contains damaged components(in which case the physical block is invalid and must not be used tostore data). Another possible descriptor may be a flag indicatingwhether a given logical block is bound to more than one correspondingphysical block. In such a case, the physical block number (or address)from column 302 may be considered the base address used for finding asplit-block record. An additional flag may be used, similarly to theflag from column 303, to indicate whether a given physical block isbound to a logical block, and another distinct flag may be used toindicate whether a given physical block is completely erased.

In one embodiment, each split-block—that is, a physical block that ispartially re-written; an occurrence when data is divided across two ormore physical blocks—has a corresponding split-block record, otherwisereferred to as a sector descriptor. Each split-block record may containa ‘next physical block’ field, which represents a pointer to the nextrecord in the split-block list. In this case, a next record may beindicating a preceding partially re-written physical block that isassociated with the same logical block. A NULL value in the ‘next’ fieldof a given record may indicate that the record is the last one in thelist. Each split-block record may also include a ‘physical address’field containing the physical address of the corresponding block. Forthe first entry in the list, the value in the ‘physical address’ fieldmay match the corresponding physical block number (or address), shown incolumn 302 of table 300. Additional fields may include a ‘dirty sector’and a ‘live sector’ field, indicating the number of sectors in the blockthat contain data (including both “live” and “stale” sectors), and thenumber of sectors in the block that contain current data (that is,sectors that have not been replaced by a new block), respectively.

In one embodiment, each split-block record also includes a dirty-sectorbitmap indicative of whether a given sector in the physical blockcontains data. The bitmap may contain a bit corresponding to each sectorin the physical block. A clear-bit may indicate that a correspondingsector is unused, while a set-bit may indicate that the correspondingsector contains data. In one set of embodiments, an unused sector mayactually contain all ‘1’s, while a sector considered ‘used’ may containdata other than all ‘1’s. The data may be stale—no longer current—due toa subsequent re-write operation, or it may be live.

FIG. 4 illustrates one embodiment of a sector descriptor for a partiallywritten physical block. In this embodiment, sector descriptor 400 has anext physical block number 401 for a preceding partially re-writtenphysical block associated with the same logical block, which in thisexample is ‘12’. Sector descriptor 400 also includes a dirty-sectorbitmap, which contains a flag 403 corresponding to each sector in thephysical block 402. In one embodiment, if the flag is clear (set to 0)then it indicates that the sector is unused, and if the bit is set (setto 1) then it indicates that the corresponding sector contains data.

In one embodiment, physical sector metadata is stored in a redundantarea of the flash-memory device, the metadata being associated with eachsector comprised in a physical block. The metadata may include a logicalblock address, a block version identifying the most recent version ofeach sector, and a flag indicating whether a sector has been erased. Thephysical sector metadata may be used in conjunction with the blockdescriptors and the split-block records (or sector descriptors) to tracksector and block characteristics for each logical block. It should benoted that when the respective block descriptor flag indicates that aphysical block has been erased—as described above—there is no need tofurther check the metadata to determine whether any sectors have beenwritten.

In one set of embodiments, when an external system requests a re-writeoperation to any one of flash-memory devices 210, FMC 200 may operate asfollows. A candidate physical block with the following attributes may belocated:

1.) The physical block is already associated with the given logicalblock.

2.) The physical block is partially re-written.

3.) The sectors associated with the re-write operation are unused.

If a candidate physical block is not available, then an unbound physicalblock may be bound to the logical block and may become a new candidatephysical block. A sector descriptor may be associated with the candidatephysical block, and the next physical block number may be set to themost recent preceding physical block associated with the same logicalblock. The re-write operation may be processed using the candidatephysical block. Finally, the dirty-sector map may be updated to indicatethat the sectors associated with the re-write operation contain data.

FMC 200 may reclaim resources at will. In one embodiment, resourcesassociated with a partially re-written block are reclaimed as follows.FMC 200 may select a candidate physical block for reclamation. FMC 200may then select a subsequent partially re-written physical blockassociated with the same logical block, and may proceed to copy alldormant sectors from the candidate block to the subsequent block, wherea dormant sector may be defined as meeting the following criteria:

a.) The sector is marked as dirty in the candidate physical block.

b.) The sector is marked as unused in the subsequent physical block.

Subsequently, FMC 200 may update the dirty-sector map associated withthe subsequent block to reflect the sectors copied in the prior step,and may reclaim the sector descriptor associated with the candidatephysical block. Finally, FMC 200 may mark the candidate physical blockas unbound in the associated block descriptor.

In another embodiment, the dirty-sector bitmap is replaced with adirty-sector list. In this embodiment, each element in the list maydescribe a range of sectors that contain data. The range may contain thenumber of a first sector that contains data, and the count of contiguoussectors that contain data. In yet another embodiment, the flag used inthe block descriptor to indicate if a block is partially re-written iseliminated, and FMC 200 may determine that the block is re-written basedon the existence of a sector descriptor. In yet another embodiment, thesector descriptor is written to the redundant area associated with eachpage or sector of the flash-memory device, allowing FMC 200 to recoverthe sector descriptor later. This may enable FMC 200 to recover dataconsistency after system shutdown and restart, or to reclaim resourceswithout merging partially re-written blocks. In yet another embodiment,where the external system issues a sequence of re-write operationstargeting dispersed (scattered) sectors that reside in distinct blockson the flash-memory device, FMC 200 maintains a plurality of sectordescriptor lists associated with each partially re-written logicalblock.

Large files or large sets of small files may typically be written tosequential sectors across the flash-memory device. Splitting the blocksduring the transfer operation (that is, during the re-write operations)may eliminate redundant data copies. For example, in case a file largerthan the size of a block is to be written, the write operation may besplit into multiple writes, each write transferring data of a specifiedsize that is smaller than the size of a block, and preferably largerthan the size of a sector. FIGS. 5A through 5E show the sequence ofevents that occur during a series of consecutive re-write operationsaccording to one embodiment, in which FMC 200 executes the re-writeoperations across block boundaries. In the diagrams of FIGS. 5A-E, FIG.6A-C, FIG. 7, FIGS. 8A-B, and FIGS. 9A-D, the abbreviation ‘US’ refersto unused sectors, meaning that the sectors do not contain useful data,‘PD’ refers to sectors containing previously written data, ‘ND’ refersto new data from a host, and ‘SD’ refers to sectors containing staledata, where stale data refers to data targeted to be updated by the(illustrated) re-write operation.

FIG. 5A shows the start of the operation, beginning with a set of threepreviously written blocks 504, 506, and 508. In other words, blocks 504,506, and 508 contain previously written data. The external system (forexample, a personal computer acting as a host) may issue a re-writecommand, targeting an address that may currently correspond to tailsection 505 of physical block 504. As shown in FIG. 5A, data to bewritten to the flash-memory device is represented by new-data 502. Asnoted, physical block 504 contains the first part of the data to beupdated, shown as tail portion 505, which can be overwritten with a headportion of new data 502. The physical blocks containing the contiguoussectors of the rest of the existing data are represented by blocks 506and 508. Previously written blocks 504, 506, and 508 currently representthe physical blocks referenced by address/addresses targeted by thehost. FMC 200 may begin the re-write operation by acquiring an unusedphysical block 510, which is a physical block that contains no data, andgenerate a ‘split-block’. Alternately, FMC 200 may allocate a new blockthat contains all stale data, erase the new block since all datacontained therein is stale, designate the new block as the unusedphysical block, and generate a ‘split-block’.

In generating the ‘split-block’, FMC 200 may write the head portion ofnew data 502 to the tail section 510 of newly allocated physical block509. Thus, tail section 510 may now correspond to stale data section 505of physical block 504. In other words, whereas the address targeted bythe host prior to the start of the write operation referenced tailsection 505 of physical block 504, that target address may now referencetail section 510 of physical block 509, as re-allocated by FMC 200. Thiscondition/reallocation may be recorded in the split-block record (storedin SRAM 208, for example) by FMC 200.

As shown in FIG. 5B, FMC 200 may next allocate new physical block 520,and continue writing a second portion of new data 502 to the headsection 522 a of physical block 520. Similarly to the previous‘split-block’, the address (targeted by the host) that originallyreferenced head section 512 a of physical block 506 may now referencehead section 522 a of physical block 520, as also re-allocated by FMC200. Thus, data in head section 512 a of physical block 506 may also bedesignated as stale by FMC 200.

FIG. 5C illustrates a third portion of new data 502 being written to acenter section of physical block 520, shown as section 522 b that alsocomprises previously written head section 522 a. Again, the address(targeted by the host) that originally referenced section 512 b (alsocomprising previously written head section 512 a) of physical block 506may now reference section 522 b of physical block 520, as alsore-allocated by FMC 200.

FIG. 5D illustrates a fourth portion of new data 502 being written tothe tail section of physical block 520, shown as section 522 c that alsocomprises previously written section 522 b. Again, the address (targetedby the host) that originally referenced section 512 c (also comprisingpreviously written section 512 b) of physical block 506 may nowreference section 522 c of physical block 520, as also re-allocated byFMC 200.

Finally, FIG. 5E illustrates the tail portion of new data 502 beingwritten to the head section 528 of newly allocated physical block 526.As previously, the address (targeted by the host) that originallyreferenced head section 524 of physical block 508 may now reference headsection 528 of physical block 526, as also re-allocated by FMC 200. Notealso that at this point physical block 506 may be designated ascontaining all stale data, and may thus be erased and marked as anavailable physical block for subsequent re-write operations.

In one set of embodiments, FMC 200 may condense split-blocks following asuccessful re-write operation, as illustrated in FIGS. 6A through 6C.FIG. 6A shows the status of the split-blocks as they appear at the endof a re-write operation, for example the end status of a re-writeoperation as illustrated in FIG. 5E. As shown in FIG. 6B, FMC 200 maywrite the previously written data sectors of physical blocks 604 and 604to the unused sectors of physical blocks 610 and 614, respectively. FMC200 may now designate physical blocks 602 and 604 as being available ascandidate blocks for future re-write operations, ending up with physicalblocks 610, 612, and 614 holding the previously written data and the newdata, as shown in FIG. 6C.

FIG. 7 illustrates how a small file (a file of smaller size than ablock) may be written, according to one embodiment. FMC 200 maydesignate new candidate physical block 704 and write the new data tosection 708 as shown. The address (targeted by the host) that originallyreferenced section 706 of physical block 702 may now reference section708 of physical block 704, as re-allocated by FMC 200. Data in section706 may be designated as stale by FMC 200.

FIGS. 8A-B illustrate how a split-block may be updated when writing asmall file, according to one embodiment. As shown in FIG. 8A, upon thehost requesting a re-write operation, FMC 200 may access physical block804, which already contains a section 808 of previously written data.Again, the address originally targeted by the host may have beenreferencing section 806 of physical block 802, but may now bereferencing section 808 of physical block 804, as previouslyre-allocated by FMC 200 (for example in a write operation as shown inFIG. 7). FMC 200 may write new data 810 to physical block 804, as shownin FIG. 8B.

FIGS. 9A-D illustrate how resources are reclaimed in one embodiment. Inthis embodiment, there may be multiple physical blocks associated withthe same logical block. FIG. 9A shows a split-block comprising physicalblocks 604 and 610, where previously written data in section 612 mayrepresent data that has overwritten the now stale data shown in section606. As shown, FMC 200 may allocate a new block 614 to service a newre-write operation that may be initiated by the host to write new data602. New data 602 may be written to section 616 of newly allocatedphysical block 614, as illustrated in FIG. 9B. In this example, the newre-write operation results in a portion of new data 602 overwriting aportion of the previously written data shown in section 612. Therefore,as shown in FIG. 9C, data from physical blocks 610 and 614 may be mergedtogether in physical block 614, where the non-updated portion of thepreviously written data in section 612 may be copied to thecorresponding sectors 618 in physical block 614. Physical block 610 maythen be erased and made available as a potential candidate block forfuture re-write operations. As shown in FIG. 9D, the result may be asingle split-block comprising physical blocks 604 and 614.

In summary, referring to FIGS. 9A-D, FMC 200 may reclaim resources bycopying data from a predecessor block (in this example sectors 612 ofphysical block 610) to a subsequent block (physical block 614). Thepredecessor block (physical block 610) may then be reclaimed. Note thatreclaiming resources at this point may not necessarily be required. Itmay be preferable to defer the reclamation in case the external systemissues a re-write of the data that would otherwise have been merged (theportion of the data in sectors 612 that was copied to sectors 618).

Although the embodiments above have been described in considerabledetail, other versions are possible. Numerous variations andmodifications will become apparent to those skilled in the art once theabove disclosure is fully appreciated. It is intended that the followingclaims be interpreted to embrace all such variations and modifications.Note the section headings used herein are for organizational purposesonly and are not meant to limit the description provided herein or theclaims attached hereto.

1. A data transfer control system, the system comprising: a memoryelement configured to store control instructions; a processing unitcoupled to the memory element and configured to execute the controlinstructions; and a storage media interface coupled to the processingunit and configured to operate according to at least a correspondingportion of the control instructions for controlling data transferto/from at least one non-volatile memory device, wherein the at leastone non-volatile memory device comprises physical erasable-units, andwherein each physical erasable-unit comprises physical subunits; whereinthe storage media interface is configured to re-write old data that waspreviously written to at least one physical erasable-unit correspondingto a respective logical erasable-unit on the at least one non-volatilememory device by writing new data directly to the at least onenon-volatile memory device; and wherein in writing the new data directlyto the at least one non-volatile memory device, the storage mediainterface is configured to: dynamically select two or more physicalerasable-units based on a relative position of available physicalsubunits within the physical erasable-units; allocate the two or morephysical erasable-units to the respective logical erasable-unit; andwrite the new data to one or more physical subunits of the two or moredynamically allocated physical erasable-units, wherein the relativeposition of the available physical subunits within each of the two ormore dynamically allocated physical erasable-units matches a relativeposition of the old data within the at least one physical erasable-unit.2. The system of claim 1, wherein in writing the new data directly tothe at least one non-volatile memory device, the storage media interfaceis configured to write the new data to one or more contiguous and/ornon-contiguous available physical subunits of the two or moredynamically allocated physical erasable-units.
 3. The system of claim 1,wherein in writing the new data directly to the at least onenon-volatile memory device, the storage media interface is configured towrite the new data without intervening copy operations.
 4. The system ofclaim 1, wherein in writing the new data directly to the at least onenon-volatile memory device, the storage media interface is configured toperform a sequence of write operations targeted to non-contiguousavailable physical subunits of any dynamically allocated one or more ofthe physical erasable-units.
 5. The system of claim 1, wherein inwriting the new data directly to the at least one non-volatile memorydevice, the storage media interface is configured to write the new datato unused locations within the at least one non-volatile memory device.6. The system of claim 1, wherein the storage media interface isconfigured to identify the two or more dynamically allocated physicalerasable-units based on: characteristics of a logical erasable-unitcorresponding to the at least one physical erasable-unit.
 7. The systemof claim 6, wherein the storage media interface is configured to trackcharacteristics of the logical erasable-unit and specifiedcharacteristics of each physical erasable-unit corresponding to thelogical erasable-unit through at least a table that contains logicalerasable-unit descriptors and physical erasable-unit records.
 8. Thesystem of claim 7, wherein the first memory element is furtherconfigured to store the table.
 9. The system of claim 7, furthercomprising at least one additional memory element configured to storethe table.
 10. The system of claim 7 further comprising a plurality ofadditional memory elements, each one of the plurality of additionalmemory elements configured to store a respective portion of the table.11. The system of claim 7, wherein each logical erasable-unit descriptorof the logical erasable-unit descriptors comprises: a physicalerasable-unit number, wherein based on the physical erasable-unitnumber, the storage media interface is configured to convert a givenlogical erasable-unit address into a corresponding physicalerasable-unit address, and convert a given physical erasable-unitaddress into a corresponding logical erasable-unit address; a firstflag, wherein based on the first flag, the storage media interface isconfigured to determine whether a given logical erasable-unit is boundto a corresponding physical erasable-unit; a second flag, wherein basedon the second flag, the storage media interface is configured todetermine whether a given physical erasable-unit comprises damagedcomponents; and a third flag; wherein based on the third flag, thestorage media interface is configured to determine whether the givenlogical erasable-unit is partially re-written.
 12. The system of claim7, wherein each physical erasable-unit record of the physicalerasable-unit records comprises: a bitmap, wherein based on the bitmap,the storage media interface is configured to determine whether a givenphysical subunit comprised in a corresponding physical erasable-unitcontains data; and a number corresponding to a next physicalerasable-unit, wherein the next physical erasable-unit succeeds apartially re-written physical erasable-unit, wherein the next physicalerasable-unit and the partially re-written physical erasable-unit areassociated with a same logical erasable-unit.
 13. The system of claim 1,wherein the memory element is a read-only memory (ROM), the non-volatilememory device is a flash-memory device, the storage media interface is aflash-media interface, and the processing unit is one of: amicroprocessor; and a microcontroller.
 14. The system of claim 13,wherein the physical erasable-units are physical blocks and the physicalsubunits are physical sectors.
 15. A method for re-writing data on anon-volatile memory device, the method comprising: receiving a requestfor a re-write operation targeting a non-volatile memory device thatcomprises physical erasable-units, wherein each physical erasable-unitcomprises physical subunits, and wherein the re-write operation isperformed to replace data associated with one or more specified logicalerasable-units of the non-volatile memory device; for each specifiedlogical erasable-unit of the one or more specified logicalerasable-units: selecting respective one or more candidate physicalerasable-units on the non-volatile memory device based on a relativeposition of one or more available physical subunits within each of therespective one or more candidate physical erasable-units; allocating therespective one or more candidate physical erasable-units to thespecified logical erasable-unit; writing replacement data to therespective one or more physical candidate erasable-units; and updatingand storing a respective record for each of the respective one or morecandidate physical erasable-units, wherein the respective recordcomprises information indicating which physical subunits of thecandidate physical erasable-unit corresponding to the respective recordare affected by the re-write operation.
 16. The method of claim 15,wherein said writing replacement data to the one or more candidatephysical erasable-units further comprises writing data to contiguousphysical subunits of one or more of the one or more physical candidateerasable-units.
 17. The method of claim 15, further comprising updating,during a subsequent re-write operation, the respective record of eachphysical erasable-unit of the one or more candidate physicalerasable-units targeted by the subsequent re-write operation.
 18. Themethod of claim 15, further comprising storing a respective record foreach partially re-written physical erasable-unit.
 19. The method ofclaim 15, further comprising clearing the respective record of a givenphysical erasable-unit once data associated with all physical subunitsof the given physical erasable-unit has been updated with replacementdata in one or more other physical erasable-units.
 20. The method ofclaim 15, wherein the re-write operation comprises a final copy phase,and wherein the method further comprises deferring the final copy phase.21. The method of claim 15 wherein the re-write operation comprises afinal copy phase, and wherein the method further comprises forcingcompletion of the final copy phase.
 22. The method of claim 21, whereinsaid forcing completion of the final copy phase is in response toreaching resource limits for storing records; wherein the method furthercomprises clearing the respective records of selected ones of the one ormore specified physical erasable-units; wherein data associated with allphysical subunits of each of the selected ones of the one or morespecified physical erasable-units has been updated with replacement datain physical erasable-units other than the selected ones of the one ormore specified physical erasable-units.
 23. The method of claim 15,wherein the non-volatile memory device is a flash-memory device, whereinthe physical erasable-units are physical blocks, and wherein thephysical subunits are physical sectors.
 24. A method for re-writing dataon a non-volatile memory device, the method comprising: receiving arequest for a re-write operation targeting a non-volatile memory devicethat comprises physical erasable-units, wherein each physicalerasable-unit comprises physical subunits, and wherein the re-writeoperation is performed to replace data associated with respectivespecified logical subunits corresponding to at least one specifiedlogical erasable-unit of the non-volatile memory device; dynamicallylocating a partially written first physical erasable-unit alreadyallocated to the at least one specified logical erasable-unit, whereinthe first physical erasable-unit as a relative position occupied by afirst portion of the respective specified logical subunits within the atleast one specified logical erasable-unit; dynamically allocating atleast a second physical erasable-unit to the at least one specifiedlogical erasable-unit, wherein the at least second physicalerasable-unit comprises unwritten second respective candidate physicalsubunits occupying a same relative position within the at least secondphysical erasable-unit as a relative position occupied by a secondportion of the respective specified logical subunits within the at leastone specified logical erasable-unit; writing replacement data to thefirst respective candidate physical subunits and to the secondrespective candidate physical subunits; and tracking respectivespecified characteristics corresponding to the at least one specifiedlogical erasable-unit and to the first physical erasable-unit and atleast second physical erasable-unit, wherein the respective specifiedcharacteristics comprise information indicating whether the dataassociated with the respective specified logical subunits has beenreplaced, and whether the first respective candidate physical subunitsand second respective candidate physical subunits have been written. 25.The method of claim 24, wherein the first respective candidate physicalsubunits are non-contiguous; and wherein the second respective candidatephysical subunits are non-contiguous.
 26. A method for re-writing dataon a non-volatile memory device, the method comprising: receiving arequest for a re-write operation targeting a non-volatile memory devicethat comprises physical erasable-units, wherein each physicalerasable-unit comprises physical subunits, and wherein the re-writeoperation is performed to replace data associated with specific logicalsubunits within a plurality of specific logical erasable-units of thenon-volatile memory device; dynamically locating partially writtencandidate physical erasable-units each already allocated to a specificone of the plurality of specific logical erasable-units, wherein eachrespective one of the partially written candidate physicalerasable-units comprises one or more unwritten respective candidatephysical subunits occupying a same relative position within therespective one of the partially written physical erasable units as arelative position occupied by a corresponding one of the specificlogical subunits within the specific one of the plurality of specificlogical erasable-units; dynamically allocating at least one additionalphysical erasable-unit to the specific one of the plurality of specificlogical erasable-units, wherein the at least one additional physicalerasable-unit comprises unwritten respective candidate physical subunitsoccupying a same relative position within the at least one additionalphysical erasable-unit as a relative position occupied by correspondingones of the specific logical subunits within the specific one of theplurality of logical erasable-units; writing replacement data to therespective candidate physical subunits comprised in the locatedcandidate physical erasable-units and in the allocated at least oneadditional physical erasable-unit; and tracking respective specifiedcharacteristics corresponding to each of the specific logicalerasable-units and to each candidate physical erasable-unit, wherein therespective specified characteristics comprise information indicatingwhether the data associated with the specific logical subunits has beenreplaced, and whether the candidate physical subunits have been written.27. A method for re-writing data on a non-volatile memory device, themethod comprising: receiving a request for a re-write operationtargeting a non-volatile memory device that comprises physicalerasable-units, wherein each physical erasable-unit comprises subunits,and wherein the re-write operation is performed to replace dataassociated with respective specified logical subunits within at leastone specified logical erasable-unit of the non-volatile memory device;dynamically allocating, in response to said receiving, an unboundpreviously written physical erasable-unit and an unbound unwrittenphysical erasable-unit to the at least one specified logicalerasable-unit, wherein the unbound previously written physicalerasable-unit and the unbound unwritten physical erasable-unit eachcomprise respective candidate physical subunits occupying a samerelative position within the unbound physical erasable-unit as at leasta corresponding portion of the respective specified logical subunitswithin the at least one specified logical erasable-unit; erasing thedynamically allocated previously written physical erasable unit;generating a record containing specified characteristics correspondingto the specified logical erasable-unit and the associated physicalerasable-units; writing replacement data to the respective candidatephysical subunits; and updating the record with information indicatingthat the data associated with the at least a portion of the respectivespecified logical subunits has been replaced, and that the respectivecandidate physical subunits have been written.
 28. A method forre-writing data on a non-volatile memory device, the method comprising:receiving a request for a re-write operation targeting a non-volatilememory device that comprises physical erasable-units, wherein eachphysical erasable-unit comprises subunits, and wherein the re-writeoperation is performed to replace data associated with respectivespecified logical subunits within a plurality of specified logicalerasable-units of the non-volatile memory device; dynamicallyallocating, in response to said receiving, at least two unboundpreviously written physical erasable-units to at least one of theplurality of specified logical erasable-units, wherein each respectivephysical erasable-unit of the at least two unbound previously writtenrespective physical erasable-units comprises respective candidatephysical subunits occupying a same relative position within the unboundphysical erasable-unit as respective ones of the at least one of therespective specified logical subunits within the plurality of specifiedlogical erasable-units; erasing the dynamically allocated at least twopreviously written physical erasable units; generating a recordcontaining specified characteristics corresponding to the plurality ofspecified logical erasable-units and the respective physicalerasable-units; writing replacement data to the respective candidatephysical subunits; and updating the record with information indicatingthat the data associated with the respective specified logical subunitshas been replaced, and that the respective candidate physical subunitshave been written.
 29. The system of claim 1, wherein the storage mediainterface is configured to identify the available physical subunits ofthe two or more dynamically allocated physical erasable-units based oncharacteristics of each physical subunit of the two or more dynamicallyallocated physical erasable-units.
 30. The method of claim 15, whereinsaid writing replacement data to the one or more candidate physicalerasable-units comprises writing data to non-contiguous availablephysical subunits of one or more of the one or more candidate physicalerasable-units.
 31. A data transfer control system, the systemcomprising: a memory element configured to store control instructions; aprocessing unit coupled to the memory element and configured to executethe control instructions; and a storage media interface coupled to theprocessing unit and configured to operate according to at least acorresponding portion of the control instructions for controlling datatransfer to/from at least one non-volatile memory device, wherein the atleast one non-volatile memory device comprises erasable-units, andwherein each erasable-unit comprises subunits; wherein the storage mediainterface is configured to re-write old data that was previously writtento the at least one non-volatile memory device by writing new datadirectly to the at least one non-volatile memory device; and wherein inwriting the new data directly to the at least one non-volatile memorydevice, the storage media interface is configured to dynamicallyallocate two or more physical erasable-units to a same logicalerasable-unit, and write the new data to one or more unwritten physicalsubunits of the two or more dynamically allocated physicalerasable-units, wherein the one or more available physical subunitsoccupy same relative positions within the two or more physicalerasable-units as the old data.
 32. A data transfer control system, thesystem comprising: a memory element configured to store controlinstructions; a processing unit coupled to the memory element andconfigured to execute the control instructions; and a storage mediainterface coupled to the processing unit and configured to operateaccording to at least a corresponding portion of the controlinstructions for controlling data transfer to/from at least onenon-volatile memory device, wherein the at least one non-volatile memorydevice comprises physical erasable-units, and wherein each physicalerasable-unit comprises physical subunits; wherein the storage mediainterface is configured to re-write old data that was previously writtento the at least one non-volatile memory device by writing new datadirectly to the at least one non-volatile memory device; and wherein inwriting the new data directly to the at least one non-volatile memorydevice, the storage media interface is configured to: dynamicallyallocate two or more physical erasable-units based on relative positionsof one or more unwritten physical subunits comprised in the dynamicallyallocated two ore more physical erasable-units, wherein the dynamicallyallocated two ore more physical erasable-units also contain one or morepreviously written physical subunits; and write the new data to the oneor more unwritten physical subunits comprised in the dynamicallyallocated two ore more physical erasable-units, wherein the one or moreavailable physical subunits are non-contiguous to the one or morepreviously written physical subunits.